package com.ineatconseil.yougo.bo;

import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "user")
public class User extends BaseEntity {

	private static final long serialVersionUID = 3923547705925058440L;

	/**
	 * Nom complet du user (Yves Delnatte par exemple)
	 */
	@Basic
	@Column(name = "full_name", nullable = false, unique = true, length = 64)
	private String fullName;

	/**
	 * E-mail du user(yves.delnatte@ineat-conseil.fr)
	 */
	@Basic
	@Column(name = "mail", nullable = false, unique = true, length = 64)
	private String mail;

	/**
	 * Mot de passe pour se connecter à l'application
	 */
	@Basic
	@Column(name = "password", nullable = false, length = 32)
	private String password;

	/**
	 * Indique si l'user a accés à la console d'admin
	 */
	@Basic
	@Column(name = "admin")
	private Boolean admin;

	/**
	 * Indique si l'user peut utiliser l'application
	 */
	@Basic
	@Column(name = "active")
	private Boolean active;

	/**
	 * Indique le type d'user (manager, simple user)
	 */
	@ManyToOne
	@JoinColumn(name = "user_type_id", nullable = false)
	private UserType type;

	@OneToMany(mappedBy = "user", cascade = { CascadeType.REMOVE })
	private Set<Request> requests;

	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Boolean getAdmin() {
		return admin;
	}

	public void setAdmin(Boolean admin) {
		this.admin = admin;
	}

	public Boolean getActive() {
		return active;
	}

	public void setActive(Boolean active) {
		this.active = active;
	}

	public UserType getType() {
		return type;
	}

	public void setType(UserType type) {
		this.type = type;
	}

	public Set<Request> getRequests() {
		return requests;
	}

	public void setRequests(Set<Request> requests) {
		this.requests = requests;
	}

}
